//
//  LCCardPageViewController.m
//  lechuang
//
//  Created by Mr_hi on 2024/8/22.
//  Copyright © 2024 Mooyi. All rights reserved.
//

#import "LCCardPageViewController.h"
#import "LCCardTaskViewController.h"
#import "LCTaskListViewController.h"
#import "XLPageViewController.h"

@interface LCCardPageViewController ()<XLPageViewControllerDelegate,XLPageViewControllerDataSrouce>

@property (nonatomic, strong) XLPageViewControllerConfig *config;
@property (nonatomic, strong) XLPageViewController *pageViewController;

@property (strong, nonatomic)NSArray * titleArr;

@end

@implementation LCCardPageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.titleArr = @[@"流量卡专区",@"信用卡专区"];
    [self inistalConfig];
    [self SetMainUI];
}

- (void)inistalConfig {
    self.config = [XLPageViewControllerConfig defaultConfig];
    self.config.titleSelectedFont = [UIFont systemFontOfSize:12];
    self.config.titleNormalFont = [UIFont systemFontOfSize:12];
    self.config.titleNormalColor = [UIColor colorWithHexString:@"#666666"];
    self.config.titleSelectedColor = [UIColor colorWithHexString:@"#FC5353"];
    self.config.titleViewHeight = 35;
    self.config.titleViewInset = UIEdgeInsetsMake(0, 17, 0, 17);
    self.config.titleWidth = (ScreenW-34)/4;
    self.config.titleSpace = 0;
    self.config.shadowLineColor = [UIColor clearColor];
    self.config.shadowImage = [UIImage imageNamed:@"lc_task_triangle_icon"];
    self.config.shadowLineHeight = 5;
    self.config.shadowLineWidth = 12;
    self.config.separatorLineColor = [UIColor clearColor];
    self.config.segmentedTintColor = [UIColor clearColor];
}

- (void)SetMainUI {
    self.pageViewController = [[XLPageViewController alloc] initWithConfig:self.config];
    self.pageViewController.view.frame = self.view.bounds;
    self.pageViewController.delegate = self;
    self.pageViewController.dataSource = self;
    self.pageViewController.selectedIndex = 0;
    self.pageViewController.bounces = NO;
    [self.view addSubview:self.pageViewController.view];
    self.pageViewController.view.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
}

- (UIViewController *)pageViewController:(XLPageViewController *)pageViewController viewControllerForIndex:(NSInteger)index {
    if (index == 0) {
        LCCardTaskViewController * listVC = [LCCardTaskViewController xx_instantiateFromStoryboardNamed:@"Task"];
        listVC.parentVC = self.parentVC;
        return listVC;
    } else {
        LCTaskListViewController * listVC = [LCTaskListViewController xx_instantiateFromStoryboardNamed:@"Task"];
        listVC.parentVC = self.parentVC;
        listVC.orderType = -1;
        return listVC;
    }
}

- (NSString *)pageViewController:(XLPageViewController *)pageViewController titleForIndex:(NSInteger)index {
    return self.titleArr[index];
}

- (NSInteger)pageViewControllerNumberOfPage {
    return self.titleArr.count;
}

- (void)pageViewController:(XLPageViewController *)pageViewController didSelectedAtIndex:(NSInteger)index {
}



@end
